<template>
    <div class="brand-wrapper">
        <!--      查询表单 -->
        <div class="search-form">
            <el-form  class="demo-form-inline" size="mini">
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="审核人">
                            <el-input placeholder="请输入" v-model="searchParams.approverId" style="width: 65%"></el-input>
                        </el-form-item>
                    </el-col>

                    <el-col :span="8">
                        <el-form-item label="记录状态">
                            <el-select v-model="searchParams.recordState" clearable placeholder="请选择">
                                <el-option
                                        v-for="(key,value) in recordStateList"
                                        :label="key"
                                        :value="value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="申诉类型">
                            <el-select v-model="searchParams.appealType" clearable placeholder="请选择">
                                <el-option
                                        v-for="(key,value) in approverList"
                                        :label="key"
                                        :value="value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item label="制单人">
                            <el-input placeholder="请输入制单人" v-model="searchParams.establishId" style="width: 70%"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="制单时间">
                            <el-date-picker
                                    style="width: 240px"
                                    type="datetimerange"
                                    :picker-options="dateOptions.pickerOptions"
                                    v-model="startDate1"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    range-separator="-"
                                    @change="chooseTime1"
                                    start-placeholder="开始日期"
                                    end-placeholder="结束日期"
                                    align="left">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="审批时间">
                            <el-date-picker
                                    style="width: 240px"
                                    type="datetimerange"
                                    :picker-options="dateOptions.pickerOptions"
                                    v-model="startDate"
                                    value-format="yyyy-MM-dd HH:mm:ss"
                                    range-separator="-"
                                    @change="chooseTime"
                                    start-placeholder="开始日期"
                                    end-placeholder="结束日期"
                                    align="left">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-form-item>
                    <el-button type="primary" @click="searchPage">查询</el-button>
                    <el-button type="warning" @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
        <!--    操作功能 -->
        <div class="crud-box">
            <el-button type="primary" size="mini" icon="el-icon-edit"
                       v-has-perm="['brand:add']"
                       @click="dialogVisible=true,formData={},findById()" >新建</el-button>
            <el-button type="success" size="mini" icon="el-icon-edit" :disabled="batchIds.length!=1" @click="dialogVisible=true" >修改</el-button>
            <el-button type="danger" size="mini" icon="el-icon-delete" :disabled="batchIds.length<=0"
                       @click="showBatchDeleteDialog">删除
            </el-button>
        </div>


        <!--    表格数据-->
        <div class="data-box">
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    @selection-change="selectChange">
                <el-table-column

                        align="center"
                        type="selection"
                        :selectable="selectable"
                        width="55">
                </el-table-column>
                <el-table-column type="expand">
                    <template slot-scope="props">
                        <el-form label-position="left" inline class="demo-table-expand">
                            <el-form-item label="申诉名称">
                                <span>{{ props.row.name }}</span>
                            </el-form-item>
                            <el-form-item label="申诉类型">
                                <span>{{ props.row.getAppealType }}</span>
                            </el-form-item>
                            <el-form-item label="申诉人">
                                <span>{{ props.row.complainant }}</span>
                            </el-form-item>
                            <el-form-item label="approverId">
                                <span>{{ props.row.审批时间 }}</span>
                            </el-form-item>
                            <el-form-item label="记录状态">
                                <span>{{ props.row.recordState }}</span>
                            </el-form-item>
                            <el-form-item label="单据状态">
                                <span>{{ props.row.numberState }}</span>
                            </el-form-item>
                            <el-form-item label="备注">
                                <span>{{ props.row.remarks }}</span>
                            </el-form-item>

                        </el-form>
                    </template>
                </el-table-column>

                <el-table-column
                        align="center"
                        prop="appealType"
                        label="申诉类型"
                        width="100">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="complainant"
                        label="申诉人"
                        width="100">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="establishTime"
                        label="制单时间"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="approverId"
                        label="审批人"
                        width="100">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="approverTime"
                        label="审批时间"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="recordState"
                        label="记录状态"
                        width="100">
                </el-table-column>

                <el-table-column
                        align="center"
                        label="操作">
                    <template v-slot="hanjie">
                        <el-button type="primary" size="mini" icon="el-icon-edit"
                                   :disabled="hanjie.row.batchStatename != '初始'"
                                   @click="dialogVisible=true,formData.id=hanjie.row.id,findById()"></el-button>
                        <el-popconfirm
                                confirm-button-text='确定'
                                cancel-button-text='取消'
                                icon="el-icon-info"
                                icon-color="red"
                                @confirm="deleteById"
                                placement="top"
                                title="是否要删除本条记录？"
                        >
                            <el-button slot="reference" type="danger" size="mini" @click="formData.id=hanjie.row.id"
                                       :disabled="hanjie.row.batchStatename != '初始'"
                                       v-has-perm="['brand:delete']" icon="el-icon-delete"></el-button>
                        </el-popconfirm>
                    </template>


                </el-table-column>
            </el-table>

        </div>


        <!--    分页-->
        <div class="page-box">
            <el-pagination
                    background
                    layout="prev, pager, next"
                    :total="total"
                    :page-size="searchParams.pageSize"
                    :current-page="searchParams.currentPage"
                    @current-change="currentPageChange"
            >
            </el-pagination>

        </div>





        <!--弹框-->
        <el-dialog
                title="实体操作"
                :visible.sync="dialogVisible"
                width="33%"
        >
            <el-form ref="form" label-width="80px" size="small">
                <el-form-item label="申诉名称">
                    <el-input v-model="formData.name"></el-input>
                </el-form-item>
                <el-form-item label="申诉类型">
                    <el-select v-model="formData.appealType" clearable placeholder="请选择">
                        <el-option
                                v-for="(key,value) in approverList"
                                :label="key"
                                :value="Number(value)">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="申诉来源">
                    <el-input v-model="formData.source"></el-input>
                </el-form-item>
                <el-form-item label="申诉人">
                    <el-input v-model="formData.complainant"></el-input>
                </el-form-item>
                <el-form-item label="申诉人联系方式">
                    <el-input v-model="formData.contact"></el-input>
                </el-form-item>
                <el-form-item label="订单编号">
                    <el-input v-model="formData.orderId"></el-input>
                </el-form-item>
            </el-form>


            <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" size="mini" @click="dialogVisible = false,addOrEdit()">确 定</el-button>
  </span>
        </el-dialog>
    </div>
</template>

<script>
import brand from "./index";
export  default  brand;
</script>
<!--src 引用css样式-->
<style src="./index.scss"  lang="scss"></style>